# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=hwatch
pkgver=0.3.7
pkgrel=0
pkgdesc="A modern alternative to the watch command"
url="https://github.com/blacknon/hwatch"
arch="aarch64 armhf armv7 ppc64le x86 x86_64"  # blocked by rust/cargo
license="MIT"
makedepends="cargo"
subpackages="
	$pkgname-doc
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/blacknon/hwatch/archive/refs/tags/$pkgver/hwatch-$pkgver.tar.gz"
options="!check"  # no tests provided

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/
	install -D -m644 man/$pkgname.1 -t "$pkgdir"/usr/share/man/man1/
	install -D -m644 completion/fish/* -t "$pkgdir"/usr/share/fish/completions/
	install -D -m644 completion/zsh/* -t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
a00b13c9fef53bd1146c1fe9dc8381a7dd37929bade8d95434f264abfca154301b673cac369bdf86053b4fcd4a0f47275bfe423e50ad6f2be75da25974fd2e55  hwatch-0.3.7.tar.gz
"
